package com.jack006.api.controller.files;

import com.jack006.api.config.MyServiceList;
import com.jack006.grace.result.GraceJSONResult;
import com.jack006.pojo.bo.NewAdminBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Classname FileUploadControllerApi
 * @Description 文件上传接口
 * @Date 2021-06-10 08:15
 * @Created by jack
 */
@Api(value = "文件上传的 Controller",tags = "文件上传的 Controller")
//@RequestMapping("/fs")
@FeignClient(name = MyServiceList.SERVICE_FILES, qualifier="fileUploadControllerApi")
public interface FileUploadControllerApi {

    @ApiOperation(value = "上传用户头像",notes = "上传用户头像",httpMethod = "POST")
    @PostMapping("/fs/uploadFace")
    GraceJSONResult uploadFace(@RequestParam("userId")String userId,
                               MultipartFile file) throws Exception;

    @ApiOperation(value = "上传多个文件",notes = "上传多个文件",httpMethod = "POST")
    @PostMapping("/fs/uploadSomeFiles")
    GraceJSONResult uploadSomeFiles(@RequestParam("userId")String userId,
                               MultipartFile[] files) throws Exception;


    @ApiOperation(value = "文件上传到 mongodb 的 GridFS 中",notes = "文件上传到 mongodb 的 GridFS 中",httpMethod = "POST")
    @PostMapping("/uploadToGridFS")
    GraceJSONResult uploadToGridFS(@RequestBody NewAdminBO newAdminBO) throws Exception;


    @ApiOperation(value = "查看人脸",notes = "查看人脸",httpMethod = "GET")
    @GetMapping("/fs/readInGridFS")
    void readInGridFS(String faceId,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws Exception;

}
